package com.blb.orderservice.controller;

import com.blb.common.entity.Order;
import com.blb.common.util.ResponseResult;
import com.blb.orderservice.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    @Autowired
    private IOrderService orderService;

    /**
     * 通过id查订单
     * @param id
     * @return
     */
    @GetMapping("/order/{id}")
    public ResponseResult<Order> getOrderById(@PathVariable Long id){
        Order order = orderService.getOrderById(id);
        return ResponseResult.ok(order);
    }
}
